package com.example.demo;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

@RestController
@RequestMapping("/request")
public class RequestController {
    @RequestMapping("/r1")
    public String r1(@RequestParam(value = "q")String keyword){
        return keyword;
    }
    @RequestMapping("/r2")
    public String r2(String username,String password){
        return "username:"+username+",password:"+password;
    }
    @RequestMapping("/r3")
    public String r3(Integer n){
        return n+"";
    }
@RequestMapping("/r4")
    public String r4(int n){
        return n+"";
}
    @RequestMapping("/r5")
    public String r5(uesrInfo uesrinfo){
        return uesrinfo.toString();
    }
    //传递数组
    @RequestMapping("r6")
    public String r6(String[] arr){
        return Arrays.toString(arr);
    }
    @RequestMapping("/r7")
    public String r7(@RequestParam List<Integer> arr){
        return arr.toString();
    }
}
